﻿using System.Collections.Generic;
using TwitterBootstrapMVC.Infrastructure;

namespace Web.UI.AdminLTE.Controls.Tab
{
    public class TabControl : HtmlElement
    {
        internal string Id { get; set; }
        internal bool InternalJustified { get; set; }
        internal int ActiveTabIndex { get; set; }
        internal HashSet<string> HeaderClasses { get; set; }

        public TabControl(string id)
            : base("div")
        {
            Id = id;
            HeaderClasses = new HashSet<string>();
            EnsureClass("nav-tabs-custom");
            EnsureHtmlAttribute("id", id);
        }

        public TabControl ActiveTab(int activeTabIndex)
        {
            ActiveTabIndex = activeTabIndex;
            return this;
        }

        public TabControl Justified(bool value = true)
        {
            InternalJustified = value;
            return this;
        }

        public TabControl Class(string cssClass, bool forHeader = false)
        {
            EnsureClass(cssClass);
            return this;
        }

        public TabControl HeaderClass(string cssClass)
        {
            HeaderClasses.Add(cssClass);
            return this;
        }

        public TabControl PullRight()
        {
           return HeaderClass("pull-right");
        }
    }
}